//
//  ProductListCell.m
//  FinancialProduct
//
//  Created by Stella on 2017/8/24.
//  Copyright © 2017年 maq. All rights reserved.
//

#import "ProductListCell.h"

@implementation ProductListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    _rightView.hidden = YES;
}
-(void)layoutSubviews{
    [super layoutSubviews];
//    self.name.preferredMaxLayoutWidth=self.name.bounds.size.width;
}
//现金管理
-(void)setMangeModel:(InvestMangeModel *)mangeModel{
    self.name.text=mangeModel.SubProductName;
    self.abcMode.text=[NSString stringWithFormat:@"%@类资产",mangeModel.ABCModel];
    self.top2.text=mangeModel.InitalAmount;
    self.top3.text=mangeModel.Initialshare;
    self.bottom1.text=mangeModel.Redeemshare;
    self.bottom2.text=mangeModel.RedeemAmount;
    self.bottom3.text=mangeModel.SurvivingShare;
    self.timeLeft.text=[NSString stringWithFormat:@"产品成立/开放日：%@",mangeModel.qPlacementDate];
}
//固收、类固收
-(void)setSetModel:(InvestAssetModel *)setModel{
    self.name.text=setModel.IMSProductName;
    self.abcMode.text=[NSString stringWithFormat:@"%@类资产",setModel.ABCModel];
    self.top2.text=setModel.qInitalAmount;
    self.top3.text=setModel.qInitialshare;
    self.bottom1.text=setModel.qBJAmt;
    self.bottom2.text=setModel.qSYAmt;
    self.timeLeft.text=[NSString stringWithFormat:@"预计清算日期：%@",setModel.qAExpectedDueDate];
    self.timeRight.text=[NSString stringWithFormat:@"产品成立/开放日：%@",setModel.qPlacementDate];
}
//一级市场
-(void)setFirstModel:(FirstAssetModel *)firstModel{
    self.name.text=firstModel.IMSProductName;
    self.abcMode.text=[NSString stringWithFormat:@"%@类资产",firstModel.ABCModel];
    self.top2.text=firstModel.qInitalAmount;
    self.top3.text=firstModel.qInitialshare;
    self.bottom1.text=firstModel.qBJAmt;
    self.bottom2.text=firstModel.qSurvivingShare;
    self.timeLeft.text=[NSString stringWithFormat:@"产品期限：%@",firstModel.ProductPeriodShow];
    self.timeRight.text=[NSString stringWithFormat:@"产品成立/开放日：%@",firstModel.qPlacementDate];
}
- (void)setFirstdic:(NSDictionary *)firstdic {
    self.name.text=firstdic[@"IMSProductName"];
    self.abcMode.text=[NSString stringWithFormat:@"%@类资产",firstdic[@"ABCModel"]];
    self.top2.text=firstdic[@"qInitalAmount"];
    self.top3.text=firstdic[@"qInitialshare"];
    self.bottom1.text=firstdic[@"qBJAmt"];
    self.bottom2.text=firstdic[@"qSurvivingShare"];
    self.timeLeft.text=[NSString stringWithFormat:@"产品期限：%@",firstdic[@"ProductPeriod"]];
    self.timeRight.text=[NSString stringWithFormat:@"产品成立/开放日：%@",firstdic[@"qPlacementDate"]];
}
//二级市场
-(void)setSecondModel:(SecondAssetModel *)secondModel{
    self.name.text=secondModel.ProductName;
    self.abcMode.text=[NSString stringWithFormat:@"%@类资产",secondModel.ABCModel];
    self.top2.text=secondModel.qInitalAmount;
    self.top3.text=secondModel.NetCount;
    self.top4.text=secondModel.qRedeemAmount;
    self.bottom1.text=secondModel.Net;
    self.bottom2.text=secondModel.qSurvivingShare;
    self.bottom3.text=secondModel.qSurvivingAmount;
    self.bottom4.text=secondModel.SYLV;
    self.timeLeft.text=[NSString stringWithFormat:@"产品成立/开放日：%@",secondModel.qPlacementDate];
    
    _rightView.hidden = NO;
}
//交易记录
-(void)setRecordModel:(RecordModel *)recordModel{
    self.name.text=recordModel.WebProductName;
    self.abcMode.text=[NSString stringWithFormat:@"%@",recordModel.IMSType];
    self.top2.text=recordModel.QAmount;
    self.top3.text=recordModel.Net;
    self.top4.text=recordModel.QShare;
    self.timeLeft.text=[NSString stringWithFormat:@"合同号：%@",recordModel.ContractNo];
    self.timeRight.text=[NSString stringWithFormat:@"交易日期：%@",recordModel.QTransactionCfmDate];
}
//历史交易
-(void)setHisRecordModel:(RecordModel *)recordModel{
    self.name.text=recordModel.WebProductName;
    self.abcMode.text=[NSString stringWithFormat:@"%@",recordModel.IMSType];
    self.top2.text=recordModel.QAmount;
    self.top3.text=recordModel.QShare;

    self.timeLeft.text=[NSString stringWithFormat:@"交易日期：%@",recordModel.QTransactionCfmDate];
}
-(void)setProductModel:(ProductModel *)productModel{
    NSString *cateNa =  productModel.ProductTypeLevel1;
    //NSLog(@"cateNa==%@",cateNa);
    self.name.text=productModel.SubProductName;
    self.abcMode.text=[NSString stringWithFormat:@"%@类资产",productModel.ABCModel];
    self.top2.text=productModel.ExpectedRate;
    self.top3.text=productModel.ProductPeriod;
    self.top4.text=productModel.amount;
    if ([cateNa isEqualToString:@"一级市场"]) {
        self.top2.text=productModel.ProductPeriod;
        self.top3.text=productModel.amount;
    }else if ([cateNa isEqualToString:@"二级市场"]) {
        self.top2.text=productModel.amount;
    }
    self.timeLeft.text=[NSString stringWithFormat:@"预约截止日期：%@",productModel.ClosingDate];
    self.timeRight.text=[NSString stringWithFormat:@"产品成立日：%@",productModel.OpenDay];
    if ([cateNa isEqualToString:@"二级市场"]||[cateNa isEqualToString:@"现金管理类"]) {
        self.timeRight.text=[NSString stringWithFormat:@"产品开放日：%@",productModel.OpenDay];
    }
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
